using System;
using Headsight.BPMN2WF.Testing.TestObjCtors;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Headsight.BPMN2WF.Testing.TestObjCtorsTest
{
    [TestClass]
    public class BPMNFlowNodeCtorTest
    {
        private BPMNFlowNodeCtor _sut;

        [TestInitialize]
        public void SetUp()
        {
            _sut = new BPMNFlowNodeCtor();
        }

        [TestMethod]
        public void Create()
        {
            var actual = _sut.Create();

            Assert.IsNotNull(actual);
        }

        [TestMethod]
        public void Create_id_is_nonnull_nonempty_inco_not_expl_set()
        {
            var actual = _sut.Create();

            Assert.AreEqual(false, String.IsNullOrEmpty(actual.Id));
            Assert.AreEqual(false, String.IsNullOrEmpty(actual.TElement.id));
            Assert.AreEqual(actual.Id, actual.TElement.id);
        }

        [TestMethod]
        public void Create_id_inco_not_expl_set_always_different_id()
        {
            var actual1 = _sut.Create();
            var actual2 = _sut.Create();

            Assert.AreNotEqual(actual1.Id, actual2.Id);
        }

        [TestMethod]
        public void WithId_is_chaining()
        {
            Assert.AreSame(_sut, _sut.WithId("**id**"));
        }

        [TestMethod]
        public void WithId_Create()
        {
            var actual = _sut.WithId("**id**").Create();

            Assert.AreEqual("**id**", actual.Id);
        }

        [TestMethod]
        public void With_tFlowElement_is_chaining()
        {
            Assert.AreSame(_sut, _sut.WithTFlowElement(new tFlowNodeCtor().Create()));
        }

        [TestMethod]
        public void With_tFlowElement_Create()
        {
            var tFlowNode = new tFlowNodeCtor().Create();

            var actual = _sut.WithTFlowElement(tFlowNode).Create();

            Assert.AreSame(tFlowNode, actual.TElement);
        }
    }
}